package com.sjb.sixteen_journey_backend.controller;


import com.sjb.sixteen_journey_backend.common.R;
import com.sjb.sixteen_journey_backend.service.IShowTicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 晒单表
 *
 * @author jcz
 * @since 2024-07-13
 */
@RestController
@RequestMapping("/show-ticket")
public class ShowTicketController {
    @Autowired
    private IShowTicketService showTicketService;

    /**
     * 获取所有晒单
     * @return
     */
    @GetMapping("showAllTicket")
    public <T> R<List<T>> showAllTicket(){
        return showTicketService.showAllTicket();
    }

    /**
     * 根据晒单id查晒单
     * @param status 晒单类型
     * @param id 晒单id
     * @return
     */
    @GetMapping("showAllTicketByIdAndStatus/{status}/{id}")
    public R showAllTicketByIdAndStatus(@PathVariable("status") Integer status,@PathVariable("id") Integer id){
        return showTicketService.showAllTicketByIdAndStatus(status,id,true);
    }


    /**
     * 根据用户id获取所有晒单
     * @return
     * @param <T>
     */
    @GetMapping("showAllTicketByUserId")
    public <T> R<List<T>> showAllTicketByUserId(){
        return showTicketService.showAllTicketByUserId();
    }


}
